using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SmartPDA.Windows.Forms;

namespace FontDialogRunner2
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void MenuExit_Click(object sender, EventArgs e)
		{
			this.Close();
		}

		private void Dialog_Click(object sender, EventArgs e)
		{

			FontDialog fd = new FontDialog();

			fd.SearchPath = this.SearchPath.Text;
			fd.FontFileExt = this.FontFileExt.Text;
			fd.FontNameOnly = this.FontNameOnly.Checked;
			fd.SelectedFont = this.FontSample.Font;

			if (fd.ShowDialog() == DialogResult.OK)
			{
				MessageBox.Show("Selected!");

				this.FontName.Text = fd.FontName + ":" + fd.FontNameID.FamilyName;
				this.FontPath.Text = fd.FontPath;
				this.FontSample.Font = fd.SelectedFont;
			}
			else
			{
				MessageBox.Show("Cancel!");
			}

			fd.Dispose();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CurrentCulture;

			this.CultureText.Text = culture.Name;
			this.LCIDText.Text = culture.LCID.ToString("x4");
		}

		private void ReadFont_Click(object sender, EventArgs e)
		{

			FontDialog fd = new FontDialog();

			Cursor.Current = Cursors.WaitCursor;

			if (fd.ReadFont())
			{
				MessageBox.Show("Font read Success");
			}
			else
			{
				MessageBox.Show("Font read Fail");
			}

			Cursor.Current = Cursors.Default;

			fd.Dispose();

		}

	}
}